package com.audaque.springboot.foshanupload.reactor.webfluxdemo.router;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * WebFlux 路由配置
 *
 * @version v1.0
 * @author: fengjinsong
 * @date: 2022年06月07日 21时03分
 */
@Slf4j
@Configuration
public class TestRouterConfiguration {


    @Bean
    public RouterFunction<ServerResponse> testRouterFunction() {
        return RouterFunctions.route()
                //全路径
                .GET("/webfluxdemo/test/hello/{name}", serverRequest -> {
                    String name = serverRequest.pathVariable("name");
                    return ServerResponse.ok().bodyValue(name);
                }).build();
    }



}
